package linklist;

public class _01linklist {
    public static void main(String[] args) {
        Node jack =  new Node("jack");
        Node tom  = new Node("tom");
        Node li = new Node("li");
        //链接三个节点
        jack.next=tom;
        tom.next = li;
        tom.pre = jack;
        li.pre = tom;
        Node first=jack;
        Node last = li;
        /*while(true){
            if(first==null){
                break;
            }
            System.out.println(first);
            first=first.next;
        }*/
        Node smith=new Node("smith");
        smith.next=tom;
        smith.pre=jack;
        jack.next=smith;
        tom.pre=smith;
        while(true){
            if(first==null){
                break;
            }
            System.out.println(first);
            first=first.next;
        }
    }
}
class Node{
    public Object item;
    public Node next;
    public Node pre;
    public Node(Object name){
        this.item = name;
    }
    public String toString(){
        return "node name="+item;
    }
}
